//
//  YZLCarRedioCell.m
//  Car
//
//  Created by dllo on 15/11/4.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "YZLCarRedioCell.h"
#import <UIImageView+WebCache.h>

@interface YZLCarRedioCell ()

@property (nonatomic, strong) UIImageView *leftImage;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *descritionLabel;

@end

@implementation YZLCarRedioCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.leftImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.leftImage];
        self.leftImage.layer.cornerRadius = 30;
        self.leftImage.layer.masksToBounds = YES;
        self.leftImage.layer.borderWidth = 0.5;
        self.leftImage.layer.borderColor = [UIColor lightGrayColor].CGColor;
        
        self.nameLabel = [[UILabel alloc] init];
//        self.nameLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.nameLabel];
        self.nameLabel.textColor = [UIColor whiteColor];
        
        self.timeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.timeLabel];
        self.timeLabel.textColor = [UIColor colorWithWhite:0.95 alpha:1.000];
        self.timeLabel.font = [UIFont systemFontOfSize:15];
        
        self.descritionLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.descritionLabel];
        self.descritionLabel.textColor = [UIColor colorWithWhite:0.95 alpha:1.000];
        self.descritionLabel.font = [UIFont systemFontOfSize:14];
        self.descritionLabel.numberOfLines = 2;
        
    }
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    self.leftImage.frame = CGRectMake(20, 10, 60, 60);
    self.nameLabel.frame = CGRectMake(90, 10, self.contentView.frame.size.width - 200, 20);
    self.timeLabel.frame = CGRectMake(self.contentView.frame.size.width - 110, 10, 100, 20);
    self.descritionLabel.frame = CGRectMake(100, 35, self.contentView.frame.size.width - 110, 40);
    
}

- (void)setModel:(YZLCarRedioModel *)model {
    
    if (_model != model) {
        _model = model;
    }
    
    [self.leftImage sd_setImageWithURL:[NSURL URLWithString:self.model.album_bigImgurl]];
    self.nameLabel.text = self.model.album_name;
    self.timeLabel.text = self.model.update_time;
    self.descritionLabel.text = self.model.album_descrition;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
